﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public sealed class MasEducationDegreeBLL : IMasEducationDegreeBLL
    {
        private static readonly IMasEducationDegreeDAL dal = DataAccess.CreateMasterEducationDegree();

        public DataSet LoadEducationDegree(Nullable<int> Sequence)
        {
            return dal.LoadEducationDegree(Sequence);
        }
        public IList<MasEducationDegreeInfo> ListEducationDegree()
        {
            return dal.ListEducationDegree(new MasEducationDegreeInfo(0));
        }
        public IList<MasEducationDegreeInfo> ListEducationDegree(string Sequence)
        {
            int Seq = (Sequence.Length > 0 ? Int32.Parse(Sequence) : 0);

            return dal.ListEducationDegree(new MasEducationDegreeInfo(Seq));
        }
        public void Insert(string Code, string Name, string NameEng, string Qualification, int ComparativeLevel, int CreatedBy)
        {
            try
            {
                dal.Insert(new MasEducationDegreeInfo(0, Code, Name, NameEng, Qualification, ComparativeLevel, "", CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Code, string Name, string NameEng, string Qualification, int ComparativeLevel, int UpdatedBy)
        {
            try
            {
                dal.Update(new MasEducationDegreeInfo(Sequence, Code, Name, NameEng, Qualification, ComparativeLevel, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                dal.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
    }
}
